From abb7f40fb848b2ec8d66a72cb1a2f4ac80273290 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Javier=20Jard=C3=B3n?= Date: Tue, 3 Jan 2012 17:52:34 +0100 Subject: [PATCH] gtkcolorsel: Do not use deprecated GdkColor api --- gtk/gtkcolorsel.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index 85de544ede..8347bd2691 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -607,7 +607,19 @@ gtk_color_selection_set_property (GObject *object, g_value_get_boolean (value)); break; case PROP_CURRENT_COLOR: - gtk_color_selection_set_current_color (colorsel, g_value_get_boxed (value)); + { + GdkColor *color; + GdkRGBA rgba; + + color = g_value_get_boxed (value); + + rgba.red = SCALE (color->red); + rgba.green = SCALE (color->green);; + rgba.blue = SCALE (color->blue); + rgba.alpha = 1.0; + + gtk_color_selection_set_current_rgba (colorsel, &rgba); + } break; case PROP_CURRENT_ALPHA: gtk_color_selection_set_current_alpha (colorsel, g_value_get_uint (value)); @@ -629,7 +641,6 @@ gtk_color_selection_get_property (GObject *object, GParamSpec *pspec) { GtkColorSelection *colorsel = GTK_COLOR_SELECTION (object); - GdkColor color; switch (prop_id) { @@ -640,8 +651,18 @@ gtk_color_selection_get_property (GObject *object, g_value_set_boolean (value, gtk_color_selection_get_has_palette (colorsel)); break; case PROP_CURRENT_COLOR: - gtk_color_selection_get_current_color (colorsel, &color); - g_value_set_boxed (value, &color); + { + GdkColor color; + GdkRGBA rgba; + + gtk_color_selection_get_current_rgba (colorsel, &rgba); + + color.red = UNSCALE (rgba.red); + color.green = UNSCALE (rgba.green); + color.blue = UNSCALE (rgba.blue); + + g_value_set_boxed (value, &color); + } break; case PROP_CURRENT_ALPHA: g_value_set_uint (value, gtk_color_selection_get_current_alpha (colorsel)); -- 2.30.2